<?php include $this->admin_tpl('meta');?>
<title>数据导入 - YzmCMS内容管理系统</title>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)" id="myform">
		<ul>
			<li>
				<span class="c-red">
					<i class="yzm-iconfont yzm-iconshuoming"></i>
					如现有的数据与导入的数据冲突，导入数据会覆盖现有数据！
				</span>
			</li>
			 <li><label><span class="c-red">*</span><?php echo $title;?>：</label>
				<span class="btn-upload form-group">
				  <input class="input-text upload-url radius" type="text" readonly style="display:inline;width:230px"><a href="javascript:void();" class="btn btn-primary radius" style="height: 30px;"><i class="yzm-iconfont yzm-iconshangchuan"></i> 浏览文件</a>
				  <input type="file" name="data_import" class="input-file">
				</span>
			 </li>			 
		</ul>
		<div class="footer_btn">
			<input type="hidden" name="dosubmit" value="1">
			<input class="btn btn-primary radius" type="submit" value="提 交">
			<input class="btn btn-default radius" type="button" value="取 消" onclick="yzmcms_close()">	
		</div>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer');?>

<script type="text/javascript">

	function dosub(obj){
		if($("input[name='data_import']").val()==''){
			layer.msg('请上传文件！', {time: 3000, icon:2});
			return false;
		}
		layer.msg('正在上传中……', { icon: 16, shade: 0.21, time:false });
		var form = document.getElementById("myform");
		var data = new FormData(form);
        $.ajax({
            type: 'POST',
            url: '<?php echo $url;?>', 
            data: data,
			dataType: "json", 
			processData: false,
			contentType: false, 
		    dataType: "json", 
            success: function (msg) {		
				if(msg.status == 1){
					layer.msg(msg.message, {time: 2000, icon:1}, function (){
						parent.location.reload();
					});     
			    }else{
					layer.msg(msg.message, {time: 3000, icon:2});
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>